<!-- 举报 -->
<template>
	<view class="reportcss">
		<view class="list-box">
			<view class="martcss">
				 投诉标题
			</view>
			<view class="text-box">
				<textarea v-model="list.name" style="height: 50rpx;" placeholder="请填写10个字以内的投诉标题" border='none'></textarea>
			</view>
			<view class="martcss">
				 {{title1}}
			</view>
			<view class="text-box">
				<textarea v-model="list.text" style="height: 150rpx;" placeholder="请填写10个字以上的问题描述以便我们提供更好的帮助" border='none'></textarea>
			</view>
			<view class="martcss">
				{{title2}}
			</view>
			<view class="phone-box">
				<input
				    placeholder="选填,便于我们与你联系"
				    border="none"
					type="number"
					maxlength=11
				    v-model="list.phone"
				 ></input>
			</view>
		</view>
		<view class="save-box" @click="saveBnt()">
			提交
		</view>
	</view>
</template>

<script>
	import * as index from '@/api/index.js'
	export default {
		data(){
			return{
				title1:'投诉内容',
				title2:'联系电话',
				list:{
					uId:uni.getStorageSync('userinfo').userId,
					text: '',
					phone:'',
					name:'',
				}
			}
		},
		onLoad(params) {
			this.list.jubao_id =params.id
			this.list.phone = uni.getStorageSync('userInfo').phone
		},
		methods:{
			//提交
			saveBnt(){

				if(!this.list.text){
					this.$tools.toast('请填写举报内容')
				}else if(!this.list.name){
					this.$tools.toast('请填写标题')
				}else if(!this.list.phone){
					this.$tools.toast('请填写手机号')
				}else if(this.list.phone.length < 11){
					this.$tools.toast('请填写正确的手机号')
				}else{
					index.tsjySave(this.list).then(res=>{
						this.$tools.succend('举报成功!')
						setTimeout(res=>{
							uni.navigateBack({
								data: 1
							})
						},500)
					})
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.reportcss{
		.list-box {
			.martcss{
				margin-top: 20px;
				display: flex;
				align-items: center;
				padding-left: 20rpx;
			}
			.phone-box {
				display: flex;
				align-items: center;
				border-bottom: 2rpx solid #f4f4f4;
				background: #ffffff;
				padding: 30rpx;
				margin-top: 20px;
				input {
					width: 100%;
				}
			}
			.text-box {
				background: #ffffff;
				padding: 30rpx 20rpx 30rpx 20rpx;
				margin-top: 20px;
				textarea {
					width: 100%;
				}
			}
		}
		.save-box {
			margin-top: 200rpx;
			width: 696rpx;
			height: 100rpx;
			background: #05c160;
			border-radius: 24rpx;
			font-size: 36rpx;
			font-weight: bold;
			color: #FFFFFF;
			line-height: 100rpx;
			text-align: center;
			margin-left: calc(50% - 348rpx);
		}
		
	}
</style>
